package reggie.ruiji.mapper;

import org.apache.ibatis.annotations.*;
import reggie.ruiji.Dto.DishDto;
import reggie.ruiji.pojo.DishFlavor;

import java.util.List;


@Mapper
public interface DishflavorMapper
{
   @Insert("<script>" +
           "insert into dish_flavor(dish_id, name, value, create_time, update_time, create_user, update_user) values " +
           "<foreach collection='dishFlavorList' item='item' separator=','>" +
           "(#{item.dishId}, #{item.name}, #{item.value}, #{item.createTime}, #{item.updateTime}, #{item.createUser}, #{item.updateUser})" +
           "</foreach>" +
           "</script>")
   public void save(List<DishFlavor> dishFlavorList);

   @Select("select * from dish_flavor where dish_id = #{id}")
   public List<DishFlavor> getDishFlavorById(Long id);

   @Delete("delete from dish_flavor where dish_id = #{id}")
   public void deletebydishID(Long id);

   @Delete("<script>" +
           "delete from dish_flavor where dish_id in " +
           "<foreach collection='ids' item='id' open='(' separator=',' close=')'>" +
           "#{id}" +
           "</foreach>" +
           "</script>")
   public void delete(List<Long> ids);




}
